package testmain;

import com.alibaba.fastjson.JSON;
import org.quickserver.util.data.dataProcessing;
import org.quickserver.util.state.QNA2B2State;
import org.quickserver.util.state.QNA2B4State;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Map;

public class test1 {
    public static void main(String[] args) throws IOException {
        int count=65536;
        for (int i = 0; i < 256; i++) {
                count++;
                String[] s=new String[1];
                s[0]=dataProcessing.strToLen9(dataProcessing.decimalToHex(i),2);

                String str=s[0];
                if(i==0){
                    s[0]="00";
                }
                Map<String, String> map= QNA2B4State.getQNA2B4State(s);
                String ss = JSON.toJSONString(map);
                String insert = "INSERT INTO `intelligent_fire_fighting`.`gb26875_state`(`id`, `hex`, `ml`, `bjzt`, `bjzt_sm`) VALUES ('"+count+"', '"+str+"', 3, '"+ss+"', NULL);";
                write(insert);
        }
    }
    public static void write(String ss)
            throws IOException {
        BufferedWriter bw = new BufferedWriter(new FileWriter("E:/1.txt",true));
        bw.write(ss);
        bw.newLine(); //换行用
        bw.close();
        System.out.println("写入成功");
    }
}
